package com.biwin.module.orm.api.dao;

import com.biwin.common.api.basic.IBwPage;
import org.hibernate.procedure.ProcedureCall;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * BiWin framework Dao
 *
 * @author biwin
 * @since 0.0.1
 */
public interface IBwHibernateDao<T> {

    void delete(T o);

    void delete(String hql, Object... params);

    void update(T o);

    void update(String hql, Object... params);

    void saveOrUpdate(T o);

    T get(Serializable id);

    T get(String hql);

    T get(String hql, Map<String, Object> params);

    T get(String hql, Object... params);

    List<T> find(String hql);

    List<T> find(String hql, Object... params);

    List<T> find(String hql, Map<String, Object> params);

    List<T> find(String hql, int page, int rows);

    IBwPage<T> findForPage(String hql, int page, int rows, String gridId);

    List<T> find(String hql, Map<String, Object> params, int page, int rows);

    IBwPage<T> findForPage(String hql, Map<String, Object> params, int page, int rows, String gridId);

    List<T> find(String hql, int page, int rows, String gridId, Object... params);

    IBwPage<T> findForPage(String hql, int page, int rows, String gridId, Object... params);

    List<T> findHql(String hql, Object... params);

    List<Object[]> findBySql(String sql, Object... params);

    void saveAll(Collection<T> entities);

    Serializable save(T o);

    void updateAll(Collection<T> entities);

    void deleteAll(Collection<T> entities);

}
